import http from './index'

/**
 *
 * @type {{STATUS_SUCCESS: number}}
 */
export const status = {
  STATUS_SUCCESS: 1
}

/**
 * 获取首页顶部广告列表
 * @param params
 * @returns {*}
 */
export const getIndexTopAdList = params => http.post('/ad/getIndexTop', params);

/**
 * 公共
 * @type {{login: (function(*=): Promise<AxiosResponse<any>>)}}
 */
export const common = {
  login: params => http.post('/index/login', params),
};

/**
 * 书
 * @type {{read: (function(*=): *), list: (function(*=): *)}}
 */
export const book = {
  list: params => http.post('/book/index', params),
  read: params => http.post('/book/read', params),
};
/**
 * 获取书籍列表
 * @param params
 * @returns {*}
 */
export const getBookList = params => book.list(params);

/**
 * 借阅记录
 * @param params
 * @returns {*}
 */
export const getBorrowList = params => http.post('/borrow/index', params);

/**
 *
 * @type {{read: (function(*=): *), updateInfo: (function(*=): *), updatePwd: (function(*=): *), submitIdea: (function(*=): *)}}
 */
export const user = {
  /**
   * 获取用户信息
   * @param params
   * @returns {*}
   */
  read: params => http.post('/user/getInfo', params),
  /**
   * 更新信息
   * @param params
   * @returns {*}
   */
  updateInfo: params => http.post('/user/updateInfo', params),
  /**
   * 修改密码
   * @param params
   * @returns {*}
   */
  updatePwd: params => http.post('/user/updatePwd', params),
  /**
   * 提交意见
   * @param params
   * @returns {*}
   */
  submitIdea: params => http.post('/user/submitIdea', params),
};
